/**
 * Copyright ©2012-2018 HopeHaiyang Corporation, All Rights Reserved
 * http://www.wuhanhope.com
 */
package hope.platform.data.utils;

import java.util.Calendar;
import java.util.Date;

/**
 * class info
 *
 * @author hujia
 *         Create at 2018/7/24 13:55
 */
public class TimeUtils {

    public static Date getBeforeTime(Date time, int minutes) {
        int hours = minutes / 60;
        int mins = minutes % 60;
        mins *= -1;

        Calendar cal = Calendar.getInstance();
        cal.setTime(time);
        cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - hours);
        cal.add(Calendar.MINUTE, mins);
        return cal.getTime();
    }

}
